<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
		<meta name="viewport" id="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta name="format-detection" content="telephone=no" />
		<link rel="stylesheet" href="/static/webAPP/css/reset.css" type="text/css"/>
		<link href="/static/webAPP/css/d7-isousuo.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="/static/webAPP/js/jquery-1.8.3.min.js" ></script>
		<title>搜索</title>
	</head>
	<body>
		<div class="d7-sousuo-wear">
			
			<div class="d7-sousuo-top">
				<a href="/static/webAPP/index.html" class="d7-sousuo-t1"></a>
				<span class="d7-sousuo-t2">
					<input type="text" placeholder="搜索商品..." name="" class="sousuo_btn">
				</span>
				<span class="d7-sousuo-t3"></span>
			</div>
		
			<div class="d7-sousuo-mid">
				<span class="d7-sousuo-tit">加载失败。。。</span>
			</div>
		</div>
		<script>
			$(function(){
				//加载热搜数据
				$.ajax({
					type: "get",
							//TODO:
					url: "/app/commodityInfo/hotSearch",
					data: '',
					dataType: "json",
					success: function(mag){
						var tag = '<span class="d7-sousuo-tit">热门搜索</span>'
						for (let i = 0; i < mag.data.length; i++) {
							tag1 = '<span class="d7-sousuo-jl1">'+ mag.data[i] +'</span>'
							tag += tag1
						}
						$(".d7-sousuo-mid").html(tag)
					}
				})
				//点击热搜和搜索实现跳转
				$(document).on("click",".d7-sousuo-jl1",function(){
					window.location = "/static/webAPP/searchgoods.html?id="+ encodeURI($(this).html()) +"";
				})

				$(".d7-sousuo-t3").on("click",function(){
					if ($(".sousuo_btn").val() != '') {
						window.location = "/static/webAPP/searchgoods.html?id="+ encodeURI($(".sousuo_btn").val()) +"";
					}
				})
			})
		</script>
	</body>
</html>
